﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using V_League.Public;


namespace V_League.DataAccess
{
    public class HLV_DataAccess
    {
        clsConnect cls;

        public HLV_Public GetInfoHLV(String Ma_HLV)
        {
            cls = new clsConnect();
            HLV_Public HLV = new HLV_Public();
            int nParameter = 1;

            String[] name = new String[nParameter];
            Object[] value =  new Object[nParameter];

            name[0] = "@MaHLV";
            value[0] = Ma_HLV;

            SqlDataReader reader = cls.ExecuteDataReader ("GetInfoHLV", name, value, nParameter);
            while (reader.Read())
            {
                HLV.Ma_HLV = Ma_HLV;
                HLV.Ten_HLV = reader["Ten_HLV"].ToString();
                HLV.NgaySinh = (DateTime)reader["NgaySinh"];
                HLV.QTich = reader["QTich"].ToString();
            }

            cls.Disconnect();
            return HLV;
        }

        public DataTable ListHLV()
        {
            cls = new clsConnect();
            DataTable dt = cls.LoadData("listHLV");
            cls.Disconnect();
            return dt;
        }
    }
}
